package com.gitee.sop.message.util;

import java.util.HashMap;
import java.util.Map;

/**
 * @author: huwei
 * @date: 2020/6/3 10:47
 * @version: 1.0.0
 */
public class MapUtil {

    public static <K ,V> MapBuilder builder(){
        return new MapBuilder<K ,V>();
    }

    public static class MapBuilder<K,V> {
        Map<K ,V> map;
        {
            this.map = new HashMap<>();
        }
        public MapBuilder elem(K key ,V value){
            this.map.put(key, value);
            return this;
        }
        public MapBuilder elem(Map<K ,V> more){
            this.map.putAll(more);
            return this;
        }
        public Map<K,V> build(){
            return map;
        }
    }
}
